package com.hksj.acm.controller;

import com.hksj.acm.dto.AlarmKindNumDTO;
import com.hksj.acm.dto.CockpitAlarmDTO;
import com.hksj.acm.dto.CockpitDeviceDTO;
import com.hksj.acm.service.CockpitService;
import com.hksj.acm.vo.*;
import com.hksj.common.core.model.Rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @author fjt
 * @data 2024/7/16 17:25
 * @describe todo
 */
@Api(tags = "空调机组-驾驶舱")
@RestController
@RequestMapping("/api/acm/cockpit")
public class CockpitController {


    @Autowired
    private CockpitService cockpitService;


    @PostMapping("/alarmList")
    @ApiOperation(value = "查询指定时间内的报警/故障记录", notes = "查询指定时间内的报警/故障记录",response = CockpitAlarmListVO.class)
    public Rest<List<CockpitAlarmListVO>> queryHistoryAlarmListByTime(@RequestBody @Valid CockpitAlarmDTO dto){
        return Rest.ok(cockpitService.queryAlarmListByTime(dto));
    }


    @PostMapping("/alarmNum")
    @ApiOperation(value = "按天统计指定时间内的温湿度报警数量", notes = "按天统计指定时间内的温湿度报警数量",response = AlarmKindNumVO.class)
    public Rest<List<AlarmKindNumVO>> queryHistoryAlarmNumByTime(@RequestBody AlarmKindNumDTO dto){
        return Rest.ok(cockpitService.queryHistoryAlarmNumByTime(dto));
    }


    @PostMapping("/currentAlarmNum")
    @ApiOperation(value = "统计设备当前报警数量", notes = "统计设备当前报警数量",response = CurrentAlarmNumVO.class)
    public Rest<CurrentAlarmNumVO> currentAlarmNum(@RequestBody AlarmKindNumDTO dto){
        return Rest.ok(cockpitService.currentAlarmNum(dto));
    }


    @PostMapping("/currentAlarmList")
    @ApiOperation(value = "查询设备当前报警列表", notes = "查询设备当前报警列表",response = CockpitAlarmListVO.class)
    public Rest<List<CockpitAlarmListVO>> currentAlarmList(@RequestBody AlarmKindNumDTO dto){
        return Rest.ok(cockpitService.currentAlarmList(dto));
    }


    @PostMapping("/deviceList")
    @ApiOperation(value = "查询设备列表", notes = "查询设备列表",response = CockpitDeviceVO.class)
    public Rest<List<CockpitDeviceVO>> deviceList(@RequestBody CockpitDeviceDTO dto){
        return Rest.ok(cockpitService.deviceList(dto));
    }


    @PostMapping("/overView")
    @ApiOperation(value = "设备概览", notes = "设备概览",response = DeviceOverviewVO.class)
    public Rest<DeviceOverviewVO> deviceOverView(@RequestBody CockpitDeviceDTO dto){
        return Rest.ok(cockpitService.deviceOverView(dto));
    }


}
